﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GrouponDesktop.HistorialCupones
{
    public partial class HistorialCupones : Form
    {
        private int IDcliente;
        public HistorialCupones(int cli)
        {
            this.IDcliente = cli;
            InitializeComponent();

            dt_desde.Format = DateTimePickerFormat.Custom;
            dt_desde.CustomFormat = "yyyy-MM-dd";
            dt_hasta.Format = DateTimePickerFormat.Custom;
            dt_hasta.CustomFormat = "yyyy-MM-dd";

        
        }

        private void b_busc_Click(object sender, EventArgs e)
        {
            BDConnection.FillGrid("select id_cupon as IDCupon, fecha_compra as FechaCompra, cantidad_comprada as CantidadComprada, codigo_grupon as Codigo from CodingSpree.TL_CUPONxUSUARIO CU where id_cliente = '" + this.IDcliente + "' and (fecha_compra between '" + dt_desde.Text + "' and '" + dt_hasta.Text + "') and NOT EXISTS (Select * from CodingSpree.TL_DEVOLUCIONES DEVO where DEVO.id_cuponxusuario = CU.id_cuponxusuario) and NOT EXISTS (Select * from CodingSpree.TL_ENTREGADOS ENT where ENT.id_cuponxusuario = CU.id_cuponxusuario)" , dgv_historial);

            dgv_historial.Columns[0].Width = 90;
            dgv_historial.Columns[1].Width = 100;
            dgv_historial.Columns[2].Width = 120;
            dgv_historial.Columns[3].Width = 120;

        }

      
        
    }
}
